<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />

    <title>注册完善信息</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />

    <link rel="stylesheet" href="/static/css/product.css" />
    <link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
    <style type="text/css">
        .weui-cless_after:after {
            border-bottom: none;
        }
    </style>
</head>

<body class="bgcolor12">
<div class="contbox">
    <div class="mui-content">

        <!--logo部分-->
            <div class="mui-col-xs-12 logo-box clear-fix">
                <img src="/static/img/logo_04.png" /><span>健维商城</span>
            </div>
        <!--logo部分-->

        <!--头像部分-->
        <div class="touxiangbox clear-fix">
            <div style="background: url(/static/img/e_02.png);background-size: 100% 100%;padding: 10px 0 30px 0;">
                <div class="xiougaibox clear-fix">
                    <div class="xiougaibox1">
                        <img src="${user.headImg}" />
                    </div>
                    <div class="xiougaibox1">
                        <h4>${user.nickName}</h4>
                    </div>
                </div>
            </div>
        </div>
        <!--头像部分-->

        <!--编辑个人信息部分-->
        <div style="margin-top: -10px">
            <div class="weui-cells weui-cells_form">
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" id="realName" maxlength="10"/>
                    </div>
                </div>
                <div class="weui-cells weui-cells_radio weui-cless_after" style="margin-top: -1px">
                    <div class="weui-cells__title weui-label" style="font-size: 17px;color: #000;">性别</div>
                    <label class="weui-cell weui-check__label" for="man">
                        <div class="weui-cell__bd">
                            <p>男</p>
                        </div>
                        <div class="weui-cell__ft">
                            <input type="radio" class="weui-check" value="1" name="sex" id="man"  checked="checked">
                            <span class="weui-icon-checked"></span>
                        </div>
                    </label>
                    <label class="weui-cell weui-check__label" for="woman">

                        <div class="weui-cell__bd">
                            <p>女</p>
                        </div>
                        <div class="weui-cell__ft">
                            <input type="radio" name="sex" value="2" class="weui-check" id="woman">
                            <span class="weui-icon-checked"></span>
                        </div>
                    </label>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">出生日期</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" id="birthday" />
                    </div>
                </div>
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                    <div class="weui-cell__hd">
                        <label class="weui-label">公司</label>
                    </div>
                    <div class="weui-cell__bd">
                        <select class="weui-select" id="company">
                            <option value="0" selected="selected">请选择</option>
                            <% for(c in company) {%>
                            <option value="${c.companyId}">${c.companyName}</option>
                            <% } %>
                        </select>
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">手机</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="tel" id="phone"/>
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">地区</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" id="areas"/>
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">地址</label></div>
                    <div class="weui-cell__bd">
                        <textarea id="addr" class="weui-textarea" placeholder="请输入地址" rows="2"></textarea>
                    </div>
                </div>
                <!--<div class="weui-cell weui-cell_select weui-cell_select-after">
                    <div class="weui-cell__hd">
                        <label class="weui-label">年龄</label>
                    </div>
                    <div class="weui-cell__bd">
                        <select class="weui-select" id="age">
                            <option value="0" selected="selected">请选择</option>
                            <% for(sd in sysDict['2']) {%>
                            <option value="${sd.dictId}">${sd.dictName}</option>
                            <% } %>
                        </select>
                    </div>
                </div>
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                    <div class="weui-cell__hd">
                        <label class="weui-label">身高</label>
                    </div>
                    <div class="weui-cell__bd">
                        <select class="weui-select" id="height">
                            <option value="0" selected="selected">请选择</option>
                            <% for(sd in sysDict['3']) {%>
                            <option value="${sd.dictId}">${sd.dictName}</option>
                            <% } %>
                        </select>
                    </div>
                </div>
                <div class="weui-cell weui-cell_select weui-cell_select-after">
                    <div class="weui-cell__hd">
                        <label class="weui-label">体重</label>
                    </div>
                    <div class="weui-cell__bd">
                        <select class="weui-select" id="weight">
                            <option value="0" selected="selected">请选择</option>
                            <% for(sd in sysDict['4']) {%>
                            <option value="${sd.dictId}">${sd.dictName}</option>
                            <% } %>
                        </select>
                    </div>
                </div>
                -->
            </div>
            <div class="weui-btn-area" style="margin-top: 28px">
                <a class="weui-btn weui-btn_primary" href="javascript:" id="registerBtn">确定</a>
            </div>
        </div>
        <!--编辑个人信息部分-->

    </div>
</div>
</body>
<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js"></script>
<script src="http://cdn.bootcss.com/jquery-weui/1.0.1/js/city-picker.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#birthday").calendar();
        $('#registerBtn').bind('click', function () {
            postForm();
        });
        $("#areas").cityPicker({
            title: "请选择城市"
        });
    });

    function postForm() {
        var realName = $('#realName').val();
        var birthday = $('#birthday').val();
        var company = $('#company').val();
        var phone = $('#phone').val();
        var sex = $("input[name='sex']:checked").val();
        var area = $('#areas').val();
        var addr = $('#addr').val();

        if (realName=='') {
            $.toptip('请输入您的真实姓名.');
            return;
        }

        if (birthday=='') {
            $.toptip('请选择您的出生日期.');
            return;
        }

        if (company=='' || company=='0') {
            $.toptip('请选择公司.');
            return;
        }

        if (phone=='') {
            $.toptip('请输入您的手机号码.');
            return;
        }

        if (area=='') {
            $.toptip('请选择您所住的区域.');
            return;
        }

        if (addr=='') {
            $.toptip('请输入您的具体住址.');
            return;
        }

        $.showLoading();

        $.post('/front/personal/updateUserInfo.do',
            {
                realName:realName,
                birthday:birthday,
                companyId:company,
                phone:phone,
                sex:sex,
                area:area,
                address:addr,
                userId:${user.userId}
            }, function (data) {
                $.hideLoading();
                if(data.ok) {
                    $.toast('信息更新完成!');
                    setTimeout(function () {
                        window.location.href = '${re}'
                    }, 800);
                } else {
                    $.toast("信息更新失败!", "cancel");
                }
            }, 'json');
    }
</script>
</html>
